
package com.flashextended.apps.logomaker.io
{
	import com.flashextended.apps.logomaker.singleton.AppLocales;
	
	/**
	 * handles all 
	 */ 
	public class IOMediator
	{
		private static var instance:IOMediator;
		
		private var ioImplementation:IOCom;
		
		public function IOMediator()
		{
		}
		
		public static function getInstance():IOMediator
		{
			if(instance==null)
			{
				instance = new IOMediator();
			}
			
			return instance;
		}
		
		/**
		 * decide if the application communicates with server or locally
		 */ 
		public function setImplementation():void
		{
			if(AppLocales.APPLICATION_TYPE == "WEB")
			{
				ioImplementation = new ServerImplementation();
			}
			else
			{
				ioImplementation = new DesktopImplementation();
			}
		}
		
		/**
		 * returns the current implementation
		 */ 
		public function get broker():IOCom
		{
			return ioImplementation;
		}

	}
}